<script setup>
import { onMounted, ref } from 'vue'
import bannerImg from '@/assets/uploads/首页-自然造物 Made in Nature-淘宝网.png'

// 使用静态数据和本地图片
const bannerList = ref([
    {
      id: 1,
      imgUrl: bannerImg,
      href: '#'
    },
    {
      id: 2,
      imgUrl: bannerImg,
      href: '#'
    }
  ])

// 保留初始化函数以维持兼容性
const getBanner = async () => {
  // 已经有静态数据，不需要再请求
  console.log('使用静态banner数据')
}

// 组件挂载时仍调用函数，保持原有的行为模式
onMounted(() => getBanner())

</script>



<template>
  <div class="home-banner">
    <el-carousel height="500px">
      <el-carousel-item v-for="item in bannerList" :key="item.id">
        <img :src="item.imgUrl" alt="">
      </el-carousel-item>
    </el-carousel>
  </div>
</template>



<style scoped lang='scss'>
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;

  img {
    width: 100%;
    height: 500px;
  }
}
</style>